<%-- 
    Document   : danhsachSP
    Created on : 17-10-2011, 20:00:21
    Author     : VuTienIT
--%>
<%@page import="java.text.DecimalFormat"%>
<%@page import="java.util.ArrayList" %>
<%@page import="model.pojo.*" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<div id="content_middle">
<h3>Danh sách sản phẩm</h3>
<%
DecimalFormat df = new DecimalFormat("#,###");
//String para1 = (String) request.getAttribute("Para1");
ArrayList<PhieuPOJO> dsPhieu = (ArrayList<PhieuPOJO>) request.getAttribute("PhieuS");
if(!dsPhieu.isEmpty())
{
    for(int i=0;i<dsPhieu.size();i++)
    {
        PhieuPOJO gg = new PhieuPOJO();
        gg = dsPhieu.get(i);
%>
    <div class="product_box">
        <p class="ngayban"><%=gg.getBatDauKhuyenMai()%></p>
    <a href=""><img src="HinhAnh/HinhChinh/<%=gg.getHinhChinh()%>" alt="" width="220" height="165" /></a>
  <h3><%=gg.getTenPhieu()%></h3>         
  <p class="price">Giá ban đầu : <strong><%=df.format(gg.getGiaGoc())%> VNĐ</strong></p>
    <p class="price">Giảm giá : <strong><%=gg.getGiamGia()%>%</strong></p>
    <p class="price">Đã mua <span class="style1"><%=gg.getSoLuongMua()%></span> lượt</p>
    <table width="100%" border="0">
      <tr>
        <td width="56%" align="center" valign="middle">
            <p align="center" class="style1"><%=df.format(gg.getGiaGoc()*((double)(100-gg.getGiamGia())/100))%> VNĐ</p>
        </td>
        <td width="44%" align="center" valign="middle">
            <a href="ChiTietSanPham?MaPhieu=<%= gg.getMaPhieu() %>" class="detail"><img src="images/button-deal-buy.png" alt="" width="102" height="38" /></a>
        </td>
      </tr>
      <tr>
          <td class="style2">
              <%
              if(gg.getSoLuongMua()>=gg.getSoLuongQuyDinh()){
                  out.println("Cháy hàng");
               }else{
            out.println("&nbsp;");
               }
              %>
          </td>
      </tr>
    </table>
    <div class="cleaner"></div>
</div>
<%
    }
}
%>
<div class="cleaner"></div>
</div>
<div id="content_middle" align="center">
    <%
    int soTrang = (Integer) request.getAttribute("soTrang");
    String lk = (String) request.getAttribute("lienket");
    if(soTrang > 1)
    {
        for(int i=1;i<=soTrang;i++){
    %>
    <a href='<%=lk%>&Trang=<%=i%>'><%=i%></a> &nbsp;
    <%
        }
    }
    %> 
</div>